package com.ktwlsoft.archivemanage.domain.business.repositoryService.guiBusiness;

import java.util.List;

import com.ktwlsoft.archivemanage.payload.businessGuidance.InstructorResult;
import com.ktwlsoft.archivemanage.payload.guiBusiness.GuiBusinessPageRequest;
import com.ktwlsoft.archivemanage.domain.dao.repository.guiBusiness.IGuiBusinessGuidanceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ktwlsoft.archivemanage.domain.dao.entity.guiBusiness.GuiBusinessGuidance;

/**
 * 业务指导业务层接口实现类
 *
 * @author zhuhe on 2020-03-12 14:07:50
 * @version 1.0
 */
@Service
public class GuiBusinessGuidanceRepositoryService {

    @Autowired
    private IGuiBusinessGuidanceMapper guiBusinessGuidanceMapper;

    /**
     * 查询分页 on 2020-03-12 14:07:50
     *
     * @param request request
     * @return PageInfo<GuiBusinessGuidance>
     */
    public PageInfo<GuiBusinessGuidance> findPage(GuiBusinessPageRequest request) {
        PageHelper.startPage(request.getPn(), request.getPageSize());
        PageInfo<GuiBusinessGuidance> pageInfo = new PageInfo<GuiBusinessGuidance>(guiBusinessGuidanceMapper.findList(request));
        return pageInfo;
    }

    /**
     * 查询分页 on 2020-03-12 14:07:50
     *
     * @param request request
     * @return PageInfo<GuiBusinessGuidance>
     */
    public PageInfo<GuiBusinessGuidance> userFindPage(GuiBusinessPageRequest request) {
        PageHelper.startPage(request.getPn(), request.getPageSize());
        PageInfo<GuiBusinessGuidance> pageInfo = new PageInfo<GuiBusinessGuidance>(guiBusinessGuidanceMapper.userFindList(request));
        return pageInfo;
    }

    /**
     * 查询集合 on 2020-03-12 14:07:50
     *
     * @param guiBusinessPageRequest guiBusinessPageRequest
     * @return List<GuiBusinessGuidance>
     */
    public List<GuiBusinessGuidance> findList(GuiBusinessPageRequest guiBusinessPageRequest) {
        return guiBusinessGuidanceMapper.findList(guiBusinessPageRequest);
    }

    /**
     * 根据ID查询信息 on 2020-03-12 14:07:50
     *
     * @param id 主键
     * @return GuiBusinessGuidance
     */
    public GuiBusinessGuidance getById(Long id) {
        return guiBusinessGuidanceMapper.getById(id);
    }

    /**
     * 根据指导单号查询是否存在 on 2020-03-12 14:07:50
     *
     * @param guidanceNum 指导单号
     * @return GuiBusinessGuidance
     */
    public List<GuiBusinessGuidance> getByGuidanceNum(String guidanceNum) {
        return guiBusinessGuidanceMapper.getByGuidanceNum(guidanceNum);
    }

    /**
     * 新增 on 2020-03-12 14:07:50
     *
     * @param guiBusinessGuidance guiBusinessGuidance
     * @return int
     */
    public int insert(GuiBusinessGuidance guiBusinessGuidance) {
        return guiBusinessGuidanceMapper.insert(guiBusinessGuidance);
    }

    /**
     * 批量插入 2020-03-12 14:07:50
     *
     * @param list list
     * @return int
     */
    public int manyInsert(List<GuiBusinessGuidance> list) {
        return guiBusinessGuidanceMapper.manyInsert(list);
    }

    /**
     * 修改 on 2020-03-12 14:07:50
     *
     * @param guiBusinessGuidance guiBusinessGuidance
     * @return int
     */
    public int update(GuiBusinessGuidance guiBusinessGuidance) {
        return guiBusinessGuidanceMapper.update(guiBusinessGuidance);
    }

    /**
     * 根据id集合批量删除信息 on 2020-03-12 14:07:50
     *
     * @param guiBusinessGuidanceArr 主键编号集合
     * @return int
     */
    public int deleteByIds(List<Long> guiBusinessGuidanceArr) {
        return guiBusinessGuidanceMapper.deleteByIds(guiBusinessGuidanceArr);
    }

    /**
     * 批量恢复 on 2020/4/13 10:47
     *
     * @param ids ids
     * @return int
     */
    public int restore(List<Long> ids){
        return guiBusinessGuidanceMapper.restore(ids);
    }

    /**
     * 根据id删除信息 on 2020-03-12 14:07:50
     *
     * @param id id
     * @return int
     */
    public int deleteById(Long id) {
        return guiBusinessGuidanceMapper.deleteById(id);
    }

    public List<InstructorResult> getInstructorList() {
        return guiBusinessGuidanceMapper.getInstructorList();
    }

    /**
     * 获取当前指导人已上报条数
     *
     * @param userId userId
     * @return int
     */
    public String getRecorderMount(Long userId) {
        return guiBusinessGuidanceMapper.getRecorderMount(userId);
    }
}
